/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package recanto.das.pedrinhas;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import recanto.das.pedrinhas.bean.Cliente;
import recanto.das.pedrinhas.bean.Endereco;
import recanto.das.pedrinhas.bean.Observacao;
import recanto.das.pedrinhas.controller.ObservacaoController;
import recanto.das.pedrinhas.dao.ClienteDao;
import recanto.das.pedrinhas.dao.EnderecoDao;

/**
 *
 * @author diego
 */
public class FramePesquisa extends javax.swing.JFrame {

    /**
     * Creates new form JanelaPesquisa
     */
    public FramePesquisa() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        inputNome = new javax.swing.JComboBox();
        botaoPesquisar = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tableObservacoes = new javax.swing.JTable();
        jPanel1 = new javax.swing.JPanel();
        labelNome = new javax.swing.JLabel();
        labelCpf = new javax.swing.JLabel();
        labelRg = new javax.swing.JLabel();
        labelProfissao = new javax.swing.JLabel();
        labelDataNasc = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        labelRua = new javax.swing.JLabel();
        labelBairro = new javax.swing.JLabel();
        labelPais = new javax.swing.JLabel();
        labelEstado = new javax.swing.JLabel();
        labelNumero = new javax.swing.JLabel();
        labelCidade = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        labelTelefone = new javax.swing.JLabel();
        labelEmail = new javax.swing.JLabel();
        botaoOk = new javax.swing.JButton();
        botaoEditarDados = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        inputNome.setEditable(true);
        inputNome.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        ClienteDao cd = new ClienteDao();
        clientes = cd.carregaClientes();
        //String[] nomes = new String[clientes.size()];
        //for(int i=0; i < clientes.size() ; ++i) {
            //    nomes[i] = clientes.get(i).getNome();
            //}
        sbm = new SearchBoxModel(inputNome, clientes);
        inputNome.setModel(sbm);
        inputNome.addItemListener(sbm);

        cd.fechaSession();
        inputNome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                inputNomeActionPerformed(evt);
            }
        });

        botaoPesquisar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        botaoPesquisar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagem/pesquisar.png"))); // NOI18N
        botaoPesquisar.setText("Pesquisar");
        botaoPesquisar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoPesquisarActionPerformed(evt);
            }
        });

        tableObservacoes.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N
        tableObservacoes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Data", "Observação"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        tableObservacoes.setRowHeight(30);
        tableObservacoes.setRowMargin(5);
        jScrollPane1.setViewportView(tableObservacoes);
        tableObservacoes.getColumnModel().getColumn(0).setMinWidth(100);
        tableObservacoes.getColumnModel().getColumn(0).setPreferredWidth(100);
        tableObservacoes.getColumnModel().getColumn(0).setMaxWidth(200);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Dados Pessoais", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Ubuntu", 1, 24))); // NOI18N

        labelNome.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelNome.setText("Nome:");

        labelCpf.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelCpf.setText("CPF:");

        labelRg.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelRg.setText("RG:");

        labelProfissao.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelProfissao.setText("Profissão:");

        labelDataNasc.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelDataNasc.setText("Data nasc.:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelNome)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelCpf)
                            .addComponent(labelDataNasc))
                        .addGap(387, 387, 387)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelProfissao)
                            .addComponent(labelRg))))
                .addContainerGap(464, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelNome)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelCpf)
                    .addComponent(labelRg))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelProfissao)
                    .addComponent(labelDataNasc))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Endereço", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Ubuntu", 1, 24))); // NOI18N

        labelRua.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelRua.setText("Rua:");

        labelBairro.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelBairro.setText("Bairro:");

        labelPais.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelPais.setText("País:");

        labelEstado.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelEstado.setText("Estado:");

        labelNumero.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
        labelNumero.setText("Numero:");

        labelCidade.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelCidade.setText("Cidade:");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(labelRua, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(labelBairro, javax.swing.GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE))
                    .addComponent(labelEstado, javax.swing.GroupLayout.PREFERRED_SIZE, 481, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelNumero)
                    .addComponent(labelPais)
                    .addComponent(labelCidade))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelRua)
                    .addComponent(labelNumero))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelBairro)
                    .addComponent(labelCidade))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelEstado)
                    .addComponent(labelPais))
                .addContainerGap())
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Contato", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Ubuntu", 1, 24))); // NOI18N

        labelTelefone.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelTelefone.setText("Telefone:");

        labelEmail.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        labelEmail.setText("Email:");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelTelefone)
                .addGap(404, 404, 404)
                .addComponent(labelEmail)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelTelefone)
                    .addComponent(labelEmail))
                .addGap(0, 11, Short.MAX_VALUE))
        );

        botaoOk.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        botaoOk.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagem/ok.png"))); // NOI18N
        botaoOk.setText("OK");
        botaoOk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoOkActionPerformed(evt);
            }
        });

        botaoEditarDados.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        botaoEditarDados.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagem/editar.png"))); // NOI18N
        botaoEditarDados.setText("Editar dados");
        botaoEditarDados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoEditarDadosActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(50, 50, 50)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(botaoEditarDados, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botaoOk, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(4, 4, 4))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(inputNome, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addComponent(botaoPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(56, 56, 56))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(inputNome, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botaoPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botaoEditarDados, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botaoOk, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(52, 52, 52))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-1181)/2, (screenSize.height-745)/2, 1181, 745);
    }// </editor-fold>//GEN-END:initComponents

    private void botaoOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoOkActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_botaoOkActionPerformed

    private void inputNomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inputNomeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_inputNomeActionPerformed

    public void preencheCampos(int index) {
        EnderecoDao enderecoDao = new EnderecoDao();
        Cliente cliente = clientes.get(index); 
        
        ObservacaoController oc = new ObservacaoController();
        //atualizaNomes();
        
        this.labelNome.setText("Nome: " + cliente.getNome());
        this.labelCpf.setText("CPF: " + cliente.getCpf());
        this.labelRg.setText("RG: " + cliente.getRg());
        this.labelDataNasc.setText("Data Nasc.: " + formataData(cliente.getDatanasc()));
        this.labelProfissao.setText("Profissão: " + cliente.getProfissao());
        this.labelTelefone.setText("Telefone: " + cliente.getTelefone());
        this.labelEmail.setText("Email: " + cliente.getEmail());
            
        if(cliente.getTipo()==0){
            Endereco endereco = enderecoDao.carregaEnderecoPorId(cliente);
            this.labelRua.setText("Rua: " + endereco.getRua());
            this.labelNumero.setText("Numero: " + endereco.getNumero());
            this.labelBairro.setText("Bairro: " + endereco.getBairro());
            this.labelCidade.setText("Cidade: " + endereco.getCidade());
            this.labelEstado.setText("Estado: " + endereco.getEstado());
            this.labelPais.setText("País: " + endereco.getPais());
        
            enderecoDao.fechaSession();
        }
        
        ArrayList<Observacao> observacoesDoCliente = oc.listaObservacaoPorClienteId(cliente);
        if (observacoesDoCliente.size()>0){
            String[][] observacoes = new String[observacoesDoCliente.size()][2];
            for (int i = 0; i < observacoesDoCliente.size(); i++) {
                observacoes[i][0] = formataData(observacoesDoCliente.get(i).getDataSaida());
                if (observacoesDoCliente.get(i).getDescricao() == null) {
                    observacoes[i][1] = "Não existe observação resgistrada nesta data";
                }else{
                    observacoes[i][1] = observacoesDoCliente.get(i).getDescricao();
                }
            }
            tableObservacoes.setModel(new javax.swing.table.DefaultTableModel(observacoes,
            new String [] {
                "Data", "Observação"
            }));
        }else{
            tableObservacoes.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {null, "Nunca esteve hospedado."}},
                new String [] {
                    "Data", "Observação"
                }));
            }
        
    }
    
    private void botaoPesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoPesquisarActionPerformed
        // TODO add your handling code here:
        limpaCampos();
        int clienteIndex = sbm.getSelectedIndex();
        preencheCampos(clienteIndex);
       
        
        
    }//GEN-LAST:event_botaoPesquisarActionPerformed

    public void atualizaNomes() {
        // Atualizando
        ClienteDao cd = new ClienteDao();
        clientes = cd.carregaClientes();
        String[] nomes = new String[clientes.size()];
        for(int i=0; i < clientes.size() ; ++i) {
            nomes[i] = clientes.get(i).getNome();
        }
        inputNome.setModel(new javax.swing.DefaultComboBoxModel(nomes));
        cd.fechaSession();
    }
    
    private void botaoEditarDadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoEditarDadosActionPerformed
        // TODO add your handling code here:
        FrameFichaCadastroTitular fichaTitular = new FrameFichaCadastroTitular();
        fichaTitular.setVisible(true);
  
        Cliente cliente = clientes.get(sbm.getSelectedIndex());
       
        fichaTitular.getInputNome().setText(cliente.getNome());
        fichaTitular.getInputCPF().setText(cliente.getCpf());
        fichaTitular.getInputRg().setText(cliente.getRg());
        fichaTitular.getInputProf().setText(cliente.getProfissao());
        fichaTitular.getInputData().setText(formataData(cliente.getDatanasc()));
        fichaTitular.getInputEmail().setText(cliente.getEmail());
        fichaTitular.getInputTel().setText(cliente.getTelefone());
        
        if (cliente.getTipo() == 0){
            EnderecoDao enderecoDao = new EnderecoDao();
            Endereco endereco = enderecoDao.carregaEnderecoPorId(cliente);
            fichaTitular.getInputRua().setText(endereco.getRua());
            fichaTitular.getInputNumero().setText(endereco.getNumero().toString());
            fichaTitular.getInputBairro().setText(endereco.getBairro());
            fichaTitular.getInputCidade().setText(endereco.getCidade());
            fichaTitular.getInputEstado().setText(endereco.getEstado());
            fichaTitular.getInputPais().setText(endereco.getPais());
            enderecoDao.fechaSession();
            fichaTitular.setEndereco(endereco);
        
        }
        
        fichaTitular.setFuncao("editar");
        fichaTitular.setCliente(cliente);
        
    }//GEN-LAST:event_botaoEditarDadosActionPerformed

    public String formataData (java.util.Date data) {
        String dataFormatada = null;
        SimpleDateFormat formatador = new SimpleDateFormat("dd/MM/yyyy");
        
        dataFormatada = formatador.format(data);
        
        return dataFormatada;
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FramePesquisa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FramePesquisa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FramePesquisa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FramePesquisa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FramePesquisa().setVisible(true);
            }
        });
    }
    
     private void limpaCampos() {
        this.labelBairro.setText("Bairro: ");
        this.labelCidade.setText("Cidade: ");
        this.labelCpf.setText("CPF: ");
        this.labelDataNasc.setText("Data Nasc.: ");
        this.labelEmail.setText("Email: ");
        this.labelEstado.setText("Estado: ");
        this.labelNome.setText("Nome: ");
        this.labelNumero.setText("Número: ");
        this.labelPais.setText("País: ");
        this.labelProfissao.setText("Profissão: ");
        this.labelRg.setText("RG: ");
        this.labelRua.setText("Rua: ");
        this.labelTelefone.setText("Telefone: ");
    }
    
    
    public List<Cliente> clientes;
    public static int selectedIndex = 0;
    public SearchBoxModel sbm;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botaoEditarDados;
    private javax.swing.JButton botaoOk;
    private javax.swing.JButton botaoPesquisar;
    private javax.swing.JComboBox inputNome;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel labelBairro;
    private javax.swing.JLabel labelCidade;
    private javax.swing.JLabel labelCpf;
    private javax.swing.JLabel labelDataNasc;
    private javax.swing.JLabel labelEmail;
    private javax.swing.JLabel labelEstado;
    private javax.swing.JLabel labelNome;
    private javax.swing.JLabel labelNumero;
    private javax.swing.JLabel labelPais;
    private javax.swing.JLabel labelProfissao;
    private javax.swing.JLabel labelRg;
    private javax.swing.JLabel labelRua;
    private javax.swing.JLabel labelTelefone;
    private javax.swing.JTable tableObservacoes;
    // End of variables declaration//GEN-END:variables
}
